import requests
from flask import Flask, jsonify

from id_test import get_film_id,get_hot_cmts

app = Flask(__name__)

@app.route('/index')
def index():
    return "index"

# /search/电影名
@app.route('/search/<string:film_name>')
def get_info(film_name):
    """

    :param film_name:
    :return:
    """
    res = get_film_id(film_name)
    print(res)
    return jsonify({"films":res})

# /detail/电影id
@app.route('/detail/<int:id>')
def get_detail(id):
    cmts = get_hot_cmts(id)
    print(cmts)
    return jsonify({"h_cmts":cmts})

if __name__ == '__main__':
    app.run()